<?xml version="1.0" encoding="utf-8"?>

<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:simpleType name="validationType">
  <xs:restriction base="xs:NMTOKEN">
    <xs:enumeration value="CompareValidator"/>
    <xs:enumeration value="RangeValidator"/>
    <xs:enumeration value="RegularExpressionValidator"/>
  </xs:restriction>
</xs:simpleType>
<xs:simpleType name="validationOperator">
  <xs:restriction base="xs:NMTOKEN">
    <xs:enumeration value="Equal"/>
    <xs:enumeration value="NotEqual"/>
    <xs:enumeration value="GreaterThan"/>
    <xs:enumeration value="GreaterThanEqual"/>
    <xs:enumeration value="LessThan"/>
    <xs:enumeration value="GreaterThanEqual"/>
    <xs:enumeration value="DataTypeCheck"/>
  </xs:restriction>
</xs:simpleType>
	<xs:element name="LLBLGenProjectGUIDefinition">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="EntityModel">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="EntityDefinitions">
								<xs:complexType>
									<xs:sequence>
										<xs:element maxOccurs="unbounded" name="EntityDefinition">
											<xs:complexType>
												<xs:sequence minOccurs="0">
													<xs:element name="Fields">
														<xs:complexType>
															<xs:sequence>
																<xs:element maxOccurs="unbounded" name="Field">
																	<xs:complexType>
																		<xs:sequence minOccurs="0">
																			<xs:element name="ValidationRules">
																				<xs:complexType>
																					<xs:sequence>
																						<xs:element name="ValidationRule">
																							<xs:complexType>
																								<xs:attribute name="Type" type="validationType" use="required"/>
																								<xs:attribute name="MinValue" type="xs:string" use="optional"/>
																								<xs:attribute name="MaxValue" type="xs:string" use="optional"/>
																								<xs:attribute name="ErrorMessage" type="xs:string" use="required"/>
																								<xs:attribute name="Operator" type="validationOperator" use="optional"/>
																								<xs:attribute name="FieldToCompare" type="xs:NCName" use="optional"/>
																								<xs:attribute name="Value" type="xs:string" use="optional"/>
																								<xs:attribute name="Expression" type="xs:string" use="optional"/>
																							</xs:complexType>
																						</xs:element>
																					</xs:sequence>
																				</xs:complexType>
																			</xs:element>
																		</xs:sequence>
																		<xs:attribute name="Name" type="xs:NCName" use="required"/>
																		<xs:attribute name="LabelText" type="xs:string" use="optional"/>
																		<xs:attribute name="UseLookupDropDownList" type="xs:boolean" use="optional"/>
																		<xs:attribute name="CustomFormat" type="xs:string" use="optional"/>
																		<xs:attribute name="RelatedField" type="xs:NCName" use="optional"/> <!-- Only when the field belongs to a TypedView -->
																	</xs:complexType>
																</xs:element>
															</xs:sequence>
														</xs:complexType>
													</xs:element>
												</xs:sequence>
												<xs:attribute name="Name" type="xs:NCName" use="required"/>
												<xs:attribute name="EntityLabel" type="xs:string" use="required"/>
												<xs:attribute name="DescriptiveField" type="xs:NCName" use="optional"/>
												<xs:attribute name="ShowValidationSummary" type="xs:boolean" use="optional"/>
												<xs:attribute name="AllowAddNew" type="xs:boolean" use="optional"/>
												<xs:attribute name="AllowEdit" type="xs:boolean" use="optional"/>
												<xs:attribute name="AllowDelete" type="xs:boolean" use="optional"/>
												<xs:attribute name="AllowExportToExcel" type="xs:boolean" use="optional"/>
											</xs:complexType>
										</xs:element>
									</xs:sequence>
								</xs:complexType>
							</xs:element>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
</xs:schema>
